package Play;

import Book.book;
import Book.booklist;

import java.util.Scanner;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: dell
 * Date: 2023-11-29
 * Time: 18:21
 */
public class borrowbook implements Feature{
    @Override
    public void work(booklist Book) {
        System.out.println("borrowbook");
        Scanner scanner =new Scanner(System.in);
        System.out.println("请输入书名");
        String name =scanner.nextLine();
        int count= Book.getBooksize();
        for (int i =0;i<count;i++){
            book Books=Book.getBook(i);
            if(Books.getName().equals(name)) {
                System.out.println("找到了");
                System.out.println(Books);
                System.out.println("1.确定 2.取消");
                int tmp = scanner.nextInt();
                if (tmp == 1) {
                    Books.setBoorwed(true);
                    System.out.println(Books);
                    return;
                }
            }
        }
    }
}